package com.jx.cashier.card;

import android.app.Activity;
import android.nfc.NfcAdapter;

import com.jx.cashier.card.impl.NFCReaderCardImpl;
import com.jx.cashier.card.impl.SunmiPayReaderCardImpl;

public class ReaderCardFactory {

    private static ReaderCard reader;

    public static ReaderCard getReader(){
        return reader;
    }

    public static ReaderCard createReader(Activity activity){
        NfcAdapter adapter = NfcAdapter.getDefaultAdapter(activity);
        if (adapter!=null){
            reader = new NFCReaderCardImpl();
        }
        else {
            reader = new SunmiPayReaderCardImpl();
        }

        if ( reader != null){
            reader.init(activity);
        }

        return reader;
    }
}
